# 导入pandas库
import pandas as pd

# 假设你的DataFrame 如下
group = pd.DataFrame({
    'value': [0, 1, 2, 3, 0,6,'-99'],
    'valuepre': [5, 0, 2, 0, 0,0,3.6]
})
# 使用where方法更改valuepre列中符合条件的值
# 找到满足条件的行，并更新'valuepre'列的值
# 找到满足条件的行，并更新'valuepre'列的值
group.loc[(group['value'].notna()) & (group['value'] != 0) & (group['value'] != '-99') & (group['value'] != group['valuepre']), 'valuepre'] = group['value']

print(group)